﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////

#pragma once

#include "GcmpModelInterface.h"
#include "IDbObject.h"

namespace gcmp {

    class IInstance;
    class IFamilyInstanceUpdateEnvironment;
    class IFamilyInstanceUpdateResult;

    /// \brief Instance更新时的自定义处理程序接口
    ///
    /// Instance提供了在Instance更新前后的自定义处理机制，需要自定义处理程序时，可以继承如下接口，并设置给IInstance
    class GCMP_MODEL_INTERFACE_EXPORT IInstanceUpdateCustomProcessor : public IDbObject
    {
        DEFINE_CAST_DERIVED(gcmp::IInstanceUpdateCustomProcessor, gcmp::IDbObject);

    public:
        /// \brief Instance更新前的处理程序
        ///
        /// \param pInstance 族实例
        /// \param pFamilyInstanceUpdateEnvironment 族服务更新环境（族服务的输入）
        /// \return 返回true表示成功进行前置处理，返回false表示失败
        virtual bool PreProcess(const IInstance *pInstance, IFamilyInstanceUpdateEnvironment* pFamilyInstanceUpdateEnvironment) = 0;

        // \brief Instance更新后的处理程序
        ///
        /// \param pInstance 族实例
        /// \param pFamilyInstanceUpdateResult 族服务更新结果（族服务的输出）
        /// \return 返回true表示成功进行后置处理，返回false表示失败
        virtual bool PostProcess(IInstance *pInstance, const IFamilyInstanceUpdateResult* pFamilyInstanceUpdateResult) = 0;
    };
}// namespace gcmp

